package com.microservice.skeleton.auth.exception;

import com.microservice.skeleton.common.vo.Result;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindException;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

import java.util.List;

/**
 * 系统例外处理
 *
 *
 */
@ControllerAdvice(basePackages = {"org.springframework.security.oauth2.provider.endpoint"})
public class GlobalExceptionController {
	private static Logger logger = LoggerFactory.getLogger(GlobalExceptionController.class);

	private final int runTimeError = 400;
	
	private final int validateError = 300;


	@ExceptionHandler(Exception.class)
	public Result handleAllException(Exception ex) {
		ex.printStackTrace();
		return Result.failure(500, ExceptionUtils.getRootCauseMessage(ex));
	}
	

}